import 'package:baselib/utils/log_util.dart';
import 'package:flutter/material.dart';
import 'package:framelib/base/base_view_model.dart';
import 'package:framelib/utils/color_util.dart';
import 'package:framelib/utils/px_util.dart';
import 'package:framelib/utils/string_util.dart';
import 'package:get/get.dart';
import 'package:module_business/comm/view/home_page.dart';
import 'package:module_business/index/view/index_page.dart';
import 'package:module_business/my/view/my_page.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class HomeViewModel extends BaseViewModel{

  double screenWidth = MediaQuery.sizeOf(Get.context!).width;
  double screenHeight = MediaQuery.sizeOf(Get.context!).height;

  int tabIndex = 0;
  List<Widget> pages = [];
  double currentX = 0.0;
  double currentY = 0.0;
  @override
  void onInit() {
    initData();
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();

  }

  void initData() {
    currentX = screenWidth-(100.w);
    currentY = screenHeight*3/4;
    pages = [
      IndexPage(),
      MyPage(),
    ];
  }

  onTap(int index) {
    if(tabIndex==index)return;
    tabIndex = index;
    update();
  }

  onCirCleButtonTap() {

    update();
  }
  onCirCleButtonUpdate(DragUpdateDetails e) {
    // e 中只能获取到 delta 值 , 需要逐步累加
    currentX += e.delta.dx;
    currentY += e.delta.dy;
    update();
  }

}